/*
 * 
 *     This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

 * 
 * BoogieMan - 2009
 *
 */

using System;
using System.Collections.Generic;
using System.Text;

namespace WoW.DataManager
{
    /// <summary>Manages WMO Data. Provides numerous useful methods to query wmo data, and does so by looking up (and if nessessary, loading in) the appropriate wmo.</summary>
    public class WMOManager
    {
        private List<WMO> wmos;

        public WMOManager()
        {
            wmos = new List<WMO>();
        }

        // Notify the wmo manager that we have just zoned.
        public void zoned()
        {
            // If we just zoned to a different map, do maintenance and flush the current wmo list
            doMaintenance(true);
        }

        // Do maintenance
        private void doMaintenance(Boolean flush)
        {
            // Delete all wmos off the list
            if (flush)
            {
                wmos = new List<WMO>();
            }

            // If the list is getting long
            if (wmos.Count > 100)
            {
                // Prune it.
                wmos = new List<WMO>();
            }
        }

        // DEBUG METHODS /////////////////////////////////////////////////////////////////
        public int DEBUG_wmoCount()
        {
            return wmos.Count;
        }
    }
}
